<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0" />
		<title></title>
	</head>

	<body>
		<p id="msg"></p>
	</body>
	<script type="text/javascript">
		var msg = document.querySelector("#msg")
		if (window.DeviceOrientationEvent) {
			window.addEventListener("deviceorientation", callback, false)
		} else {
			alert("您该换手机了 魅族值得拥有");
		}
		function callback(event) {
			var ev = event || window.event;
			msg.innerHTML = "alpha:" + parseInt(ev.alpha) + ",beta:" + parseInt(ev.beta) + ",gamma:" + parseInt(ev.gamma);
			msg.style.webkitTransform = "rotate(" + alpha + "deg)";
		}
	</script>
</html>